home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / enemy / BugA.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  24.2 KB  |  801 lines

  1. class classes.enemy.BugA
  2. {
  3.    var x;
  4.    var y;
  5.    var moveScript;
  6.    var matrixCoords;
  7.    var form;
  8.    var id;
  9.    var clip;
  10.    var colorR;
  11.    var trans;
  12.    var colorTrans;
  13.    var advanceMax;
  14.    var advanceMax2;
  15.    var matrixVar;
  16.    var dir;
  17.    var f2;
  18.    var scc;
  19.    var axis;
  20.    var switchDir;
  21.    var sfc;
  22.    var sfMax;
  23.    var xDest;
  24.    var yDest;
  25.    var oldDir;
  26.    var firing;
  27.    var fc;
  28.    var xMov = 0;
  29.    var yMov = 0;
  30.    var xmt = 0;
  31.    var ymt = 0;
  32.    var xMovT = 0;
  33.    var yMovT = 0;
  34.    var speedOrig = 9;
  35.    var speed = 9;
  36.    var xDestMet = false;
  37.    var yDestMet = false;
  38.    var c = 0;
  39.    var feelerInfo = [[-400,0,400,40],[0,0,400,40],[0,-400,40,400],[0,0,40,400]];
  40.    var dirArray = ["L","R","U","D"];
  41.    var life = 6;
  42.    var nudging = false;
  43.    var nc = 0;
  44.    var xA = 0;
  45.    var yA = 0;
  46.    var power = 25;
  47.    var Name = "bugA";
  48.    function BugA(px, py, pmoveScript, pmatrixCoords, pform, pid)
  49.    {
  50.       this.x = px;
  51.       this.y = py;
  52.       this.moveScript = pmoveScript.slice();
  53.       this.matrixCoords = pmatrixCoords.slice();
  54.       this.form = pform.slice();
  55.       this.id = pid;
  56.       _root.d = _root.d + 1;
  57.       this.clip = _root.attachMovie("bugA","bugA" + this.id + "Clip",_root.d + 50000);
  58.       this.clip._x = this.x;
  59.       this.clip._y = this.y;
  60.       this.speed *= _root.dif.speed;
  61.       this.speedOrig = this.speed;
  62.       this.life *= _root.dif.life;
  63.       this.colorR = _root.randRange(-30,30);
  64.       this.trans = new flash.geom.Transform(this.clip);
  65.       this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,this.colorR,this.colorR,this.colorR,0);
  66.       this.trans.colorTransform = this.colorTrans;
  67.       this.advanceMax = 60 / (this.speed / 2);
  68.       this.advanceMax2 = 50 / (this.speed / 2);
  69.       if(this.matrixCoords[0] == "free")
  70.       {
  71.          this.matrixVar = 0;
  72.       }
  73.       else
  74.       {
  75.          this.matrixVar = 1;
  76.       }
  77.       this.speedVar();
  78.       this.clip.body.eye2.eye.gotoAndPlay(10);
  79.       this.clip.body.eye3.eye.gotoAndPlay(20);
  80.       this.parseMoveScript();
  81.       _root.stats.created = _root.stats.created + 1;
  82.    }
  83.    function broBehind()
  84.    {
  85.       this.dir = _root.advanceDir;
  86.    }
  87.    function bombed(num)
  88.    {
  89.       this.f2 = "death";
  90.    }
  91.    function switchScope()
  92.    {
  93.       this.scc = 0;
  94.       this.getDirString();
  95.       this.f2 = "switchScoping";
  96.       this.c = 5;
  97.       this.speed /= 2;
  98.       this[this.axis + "MovT"] /= 2;
  99.       this.clip.body.flame.gotoAndStop("still");
  100.       _root.audio.playLevel2("bugASwitch",_root.randRange(8,15));
  101.    }
  102.    function switchScoping()
  103.    {
  104.       this.c = this.c + 1;
  105.       if(this.c == 10)
  106.       {
  107.          this.scc = this.scc + 1;
  108.          this.c = 0;
  109.          if(this.dir == "U" || this.dir == "D")
  110.          {
  111.             _root.d = _root.d + 1;
  112.             _root.attachMovie("sight","sightClip",_root.d);
  113.             _root.sightClip.gotoAndStop("bugASwitchFire");
  114.             _root.sightClip._x = this.x;
  115.             _root.sightClip._y = this.y;
  116.             if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  117.             {
  118.                this.switchFire("L");
  119.             }
  120.             else
  121.             {
  122.                _root.sightClip._rotation = 180;
  123.                if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  124.                {
  125.                   this.switchFire("R");
  126.                }
  127.             }
  128.             removeMovieClip(_root.sightClip);
  129.          }
  130.          else
  131.          {
  132.             _root.d = _root.d + 1;
  133.             _root.attachMovie("sight","sightClip",_root.d);
  134.             _root.sightClip.gotoAndStop("bugASwitchFire");
  135.             _root.sightClip._x = this.x;
  136.             _root.sightClip._y = this.y;
  137.             _root.sightClip._rotation = 90;
  138.             if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  139.             {
  140.                this.switchFire("U");
  141.             }
  142.             else
  143.             {
  144.                _root.sightClip._rotation = -90;
  145.                if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  146.                {
  147.                   this.switchFire("D");
  148.                }
  149.             }
  150.             removeMovieClip(_root.sightClip);
  151.          }
  152.          if(this.scc > _root.randRange(9,12))
  153.          {
  154.             this.clip.body.gotoAndStop("main");
  155.             this.speed = this.speedOrig;
  156.             this[this.axis + "MovT"] *= 2;
  157.             this.clip.body.flame.gotoAndPlay("start");
  158.             this.f2 = "wander";
  159.          }
  160.       }
  161.    }
  162.    function switchFire(tmpDir)
  163.    {
  164.       this.clip.gotoAndStop("fly" + tmpDir);
  165.       this.switchDir = tmpDir;
  166.       this.c = 0;
  167.       this.sfc = 0;
  168.       this.f2 = "switchFiring";
  169.       this.sfMax = _root.randRange(1,4);
  170.    }
  171.    function switchFireBlast()
  172.    {
  173.       this.clip.body.gotoAndPlay("switchFire");
  174.       if(this.switchDir == "L")
  175.       {
  176.          var _loc3_ = this.x - 24;
  177.          var _loc4_ = this.dir != "U" ? this.y + 21 : this.y + 3;
  178.       }
  179.       else if(this.switchDir == "R")
  180.       {
  181.          _loc3_ = this.x + 9;
  182.          _loc4_ = this.dir != "U" ? this.y + 21 : this.y + 3;
  183.       }
  184.       else if(this.switchDir == "U")
  185.       {
  186.          _loc3_ = this.dir != "L" ? this.x + 21 : this.x + 3;
  187.          _loc4_ = this.y - 36;
  188.       }
  189.       else
  190.       {
  191.          _loc3_ = this.dir != "L" ? this.x + 21 : this.x + 3;
  192.          _loc4_ = this.y + 15;
  193.       }
  194.       _root.enemyShotID = _root.enemyShotID + 1;
  195.       _root["bugASwitchBlast" + _root.enemyShotID] = new classes.shots.BugASwitchBlast(_loc3_,_loc4_,this.switchDir,_root.enemyShotID);
  196.       _root.addEnemyShot("bugASwitchBlast" + _root.enemyShotID);
  197.       _root.audio.playLevel3("bugASwitchBlast" + (random(2) + 1),_root.randRange(15,25));
  198.    }
  199.    function switchFiring()
  200.    {
  201.       this.c = this.c + 1;
  202.       if(this.c == 10)
  203.       {
  204.          this.clip.body.gotoAndPlay("switch");
  205.       }
  206.       if(this.c == 17)
  207.       {
  208.          this.switchFireBlast();
  209.       }
  210.       if(this.c == 24)
  211.       {
  212.          this.switchFireBlast();
  213.          this.c = 18;
  214.          this.sfc = this.sfc + 1;
  215.          if(this.sfc == this.sfMax)
  216.          {
  217.             this.clip.body.gotoAndPlay("switchRev");
  218.             this.c = 33;
  219.          }
  220.       }
  221.       if(this.c == 45)
  222.       {
  223.          this.clip.gotoAndStop("fly" + this.dir);
  224.          this.clip.body.gotoAndStop("main");
  225.          this.speed = this.speedOrig;
  226.          this[this.axis + "MovT"] *= 2;
  227.          this.clip.body.flame.gotoAndPlay("start");
  228.       }
  229.    }
  230.    function nudge(pxA, pyA, pscale)
  231.    {
  232.       this.nc = 0;
  233.       this.nudging = true;
  234.       var _loc2_ = pscale / 100;
  235.       this.xA = pxA * _loc2_;
  236.       this.yA = pyA * _loc2_;
  237.    }
  238.    function speedVar()
  239.    {
  240.       if(random(3) == 1)
  241.       {
  242.          this.speed *= _root.randRange2(0.99999,1.00001);
  243.       }
  244.    }
  245.    function parseMoveScript()
  246.    {
  247.       this.dir = this.moveScript[0];
  248.       if(this.dir == "break")
  249.       {
  250.          delete this.moveScript;
  251.          if(this.matrixCoords[0] == "free")
  252.          {
  253.             if(random(2) == 1)
  254.             {
  255.                this.f2 = "wander";
  256.                this[this.axis + "MovT"] = 0;
  257.                this.axis = this.axis != "y" ? "y" : "x";
  258.                this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  259.                this.speedVar();
  260.                this.getDirString();
  261.             }
  262.             else
  263.             {
  264.                this.switchScope();
  265.             }
  266.          }
  267.          else
  268.          {
  269.             this[this.axis + "MovT"] = 0;
  270.             this.xDest = _root.advanceDir != "L" ? this.matrixCoords[0] * 60 : this.matrixCoords[0] * 60 + 320;
  271.             this.yDest = this.matrixCoords[1] * 50 + 10;
  272.             this.axis = Math.abs(this.xDest - this.x) <= Math.abs(this.yDest - this.y) ? "y" : "x";
  273.             this[this.axis + "MovT"] = this[this.axis + "Dest"] <= this[this.axis] ? -1 * this.speed : this.speed;
  274.             this.getDirString();
  275.             this.speedVar();
  276.             this.f2 = "gotoMatrix";
  277.          }
  278.       }
  279.       else
  280.       {
  281.          this[this.axis + "MovT"] = 0;
  282.          this.f2 = "gotoXYDest";
  283.          this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  284.          this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  285.          this.speedVar();
  286.          if(this.dir == "L" || this.dir == "U")
  287.          {
  288.             this[this.axis + "Dest"] = this[this.axis] - this.moveScript[1];
  289.          }
  290.          else
  291.          {
  292.             this[this.axis + "Dest"] = this[this.axis] + this.moveScript[1];
  293.          }
  294.          this.moveScript.splice(0,2);
  295.       }
  296.    }
  297.    function gotoXYDest()
  298.    {
  299.       if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
  300.       {
  301.          if(this.axis == "x")
  302.          {
  303.             this.x = this.xDest;
  304.          }
  305.          else
  306.          {
  307.             this.y = this.yDest;
  308.          }
  309.          this.parseMoveScript();
  310.       }
  311.    }
  312.    function gotoMatrix()
  313.    {
  314.       if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
  315.       {
  316.          if(this.axis == "x")
  317.          {
  318.             this.x = this.xDest;
  319.          }
  320.          else
  321.          {
  322.             this.y = this.yDest;
  323.          }
  324.          this[this.axis + "MovT"] = 0;
  325.          this.axis = this.axis != "x" ? "x" : "y";
  326.          this[this.axis + "MovT"] = this[this.axis + "Dest"] <= this[this.axis] ? -1 * this.speed : this.speed;
  327.          this.getDirString();
  328.          this.speed = this.speedOrig;
  329.       }
  330.       if(Math.abs(this.x - this.xDest) < this.speed + 1 && Math.abs(this.y - this.yDest) < this.speed + 1)
  331.       {
  332.          this.x = this.clip._x = this.xDest;
  333.          this.y = this.clip._y = this.yDest;
  334.          this.xMovT = this.xMov = 0;
  335.          this.yMovT = this.yMov = 0;
  336.          this.matrixVar = 2;
  337.          this.dir = _root.advanceDir;
  338.          this.clip.body.flame.gotoAndPlay("still");
  339.          _root.matrixNum = _root.matrixNum + 1;
  340.          if(_root.matrixNum >= _root.matrixSize)
  341.          {
  342.             _root.matrixComplete = true;
  343.          }
  344.          _root["formB" + this.form[0]] = "matrixed";
  345.          this.f2 = "wait";
  346.       }
  347.    }
  348.    function getDirString()
  349.    {
  350.       if(this.xMovT < -1)
  351.       {
  352.          this.dir = "L";
  353.       }
  354.       else if(this.xMovT > 1)
  355.       {
  356.          this.dir = "R";
  357.       }
  358.       else if(this.yMovT > 1)
  359.       {
  360.          this.dir = "D";
  361.       }
  362.       else if(this.yMovT < -1)
  363.       {
  364.          this.dir = "U";
  365.       }
  366.    }
  367.    function evade()
  368.    {
  369.       if(this.matrixVar == 2)
  370.       {
  371.          this.matrixVar = 0;
  372.          this.f2 = "wander";
  373.          this.axis = random(10) <= 4 ? "y" : "x";
  374.          this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  375.          this.speedVar();
  376.          this.getDirString();
  377.       }
  378.       else if(this.f2 == "wander")
  379.       {
  380.          this[this.axis + "MovT"] = 0;
  381.          this.axis = this.axis != "x" ? "x" : "y";
  382.          this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  383.          this.getDirString();
  384.       }
  385.    }
  386.    function wait()
  387.    {
  388.       if(random(1000) >= 998 + _root.dif.wait && _root.matrixComplete)
  389.       {
  390.          this.dir = this.findDir();
  391.          this.clip.body.flame.gotoAndPlay("start");
  392.          if(this.dir == _root.advanceDir)
  393.          {
  394.             this.matrixVar = 0;
  395.             this.xMovT = _root.advanceDir != "L" ? this.speed : -1 * this.speed;
  396.             this.f2 = "attacking";
  397.          }
  398.          else if(this.dir == "U" || this.dir == "D")
  399.          {
  400.             this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  401.             this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  402.             this.matrixVar = 0;
  403.             this.c = 0;
  404.             this.f2 = "leavingMatrix";
  405.          }
  406.       }
  407.    }
  408.    function leavingMatrix()
  409.    {
  410.       this.c = this.c + 1;
  411.       if(this.c > this.advanceMax2)
  412.       {
  413.          this.c = 0;
  414.          this.dir = this.findDir();
  415.          if(this.dir == _root.advanceDir)
  416.          {
  417.             this.yMovT = 0;
  418.             this.xMovT = _root.advanceDir != "L" ? this.speed : -1 * this.speed;
  419.             this.f2 = "attacking";
  420.          }
  421.       }
  422.    }
  423.    function findDir()
  424.    {
  425.       _root.d = _root.d + 1;
  426.       _root.attachMovie("feeler","feelerClip",_root.d);
  427.       var _loc7_ = [];
  428.       var _loc9_ = 0;
  429.       var _loc11_ = this.dirArray.length;
  430.       while(_loc9_ < _loc11_)
  431.       {
  432.          _root.feelerClip._x = this.x + this.feelerInfo[_loc9_][0];
  433.          _root.feelerClip._y = this.y + this.feelerInfo[_loc9_][1];
  434.          _root.feelerClip._width = this.feelerInfo[_loc9_][2];
  435.          _root.feelerClip._height = this.feelerInfo[_loc9_][3];
  436.          var _loc3_ = 0;
  437.          var _loc8_ = _root.chars.length;
  438.          var _loc6_ = false;
  439.          while(_loc3_ < _loc8_)
  440.          {
  441.             var _loc5_ = _root.chars[_loc3_] + "Clip";
  442.             if(_root.feelerClip.hitTest(_root[_loc5_]))
  443.             {
  444.                var _loc4_ = _root.chars[_loc3_];
  445.                if(_root[_loc4_].matrixVar == 2 && _loc4_ != this.Name + this.id)
  446.                {
  447.                   _loc6_ = true;
  448.                   break;
  449.                }
  450.             }
  451.             _loc3_ = _loc3_ + 1;
  452.          }
  453.          if(!_loc6_)
  454.          {
  455.             var _loc10_ = _root.advanceDir != "L" ? "L" : "R";
  456.             if(this.dirArray[_loc9_] != _loc10_)
  457.             {
  458.                _loc7_.push(this.dirArray[_loc9_]);
  459.             }
  460.          }
  461.          _loc9_ = _loc9_ + 1;
  462.       }
  463.       _loc9_ = 0;
  464.       _loc11_ = _loc7_.length;
  465.       if(_loc9_ < _loc11_)
  466.       {
  467.          if(_loc7_[_loc9_] == _root.advanceDir)
  468.          {
  469.             return _root.advanceDir;
  470.          }
  471.          return _loc7_[random(_loc7_.length)];
  472.       }
  473.    }
  474.    function attacking()
  475.    {
  476.       this.xMovT *= 1.03;
  477.       this.yMovT *= 1.03;
  478.    }
  479.    function death()
  480.    {
  481.       _root.stats.destroyed = _root.stats.destroyed + 1;
  482.       _root.stats.score += 2500;
  483.       _root.powerUp(this.x,this.y,95);
  484.       if(this.matrixVar == 1)
  485.       {
  486.          _root.matrixNum = _root.matrixNum + 1;
  487.          if(_root.matrixNum >= _root.matrixSize)
  488.          {
  489.             _root.matrixComplete = true;
  490.          }
  491.       }
  492.       var _loc3_ = 0;
  493.       var _loc4_ = _root["form" + this.form[0]].length;
  494.       while(_loc3_ < _loc4_)
  495.       {
  496.          if(_root["form" + this.form[0]][_loc3_] == "bugA" + this.id)
  497.          {
  498.             _root["form" + this.form[0]].splice(_loc3_,1);
  499.             if(_root["form" + this.form[0]].length == 0)
  500.             {
  501.                delete _root["form" + this.form[0]];
  502.                if(_root["formB" + this.form[0]] == "matrixed")
  503.                {
  504.                   _loc3_ = 0;
  505.                   _loc4_ = random(4) + 2;
  506.                   while(_loc3_ < _loc4_)
  507.                   {
  508.                      _root.createPowerUp([this.x,this.y,"coin1"]);
  509.                      _loc3_ = _loc3_ + 1;
  510.                   }
  511.                   _root.stats.score += 2500;
  512.                }
  513.                else
  514.                {
  515.                   _root.createPowerUp([this.x,this.y,"coin5"]);
  516.                   _loc3_ = 0;
  517.                   _loc4_ = random(3) + 1;
  518.                   while(_loc3_ < _loc4_)
  519.                   {
  520.                      _root.createPowerUp([this.x,this.y,"coin1"]);
  521.                      _loc3_ = _loc3_ + 1;
  522.                   }
  523.                   _root.stats.score += 5000;
  524.                }
  525.                delete _root["formB" + this.form[0]];
  526.             }
  527.             break;
  528.          }
  529.          _loc3_ = _loc3_ + 1;
  530.       }
  531.       _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(80,130),_root.randRange(75,100),"Green"]);
  532.       _root.audio.playLevel4("bugX" + (random(4) + 1),_root.randRange(7,17));
  533.       var _loc5_ = 0;
  534.       var _loc6_ = random(3);
  535.       while(_loc5_ < _loc6_)
  536.       {
  537.          _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"bugA","Blue"]);
  538.          _loc5_ = _loc5_ + 1;
  539.       }
  540.       _root.createEnemySoul([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"red"]);
  541.       _root.removeChar("bugA" + this.id);
  542.       this.f2 = "";
  543.    }
  544.    function advance()
  545.    {
  546.       this.dir = _root.advanceDir;
  547.       this.clip.body.flame.gotoAndPlay("advance");
  548.       this.xMovT = _root.advanceDir != "L" ? 1 * (this.speed / 2) : -1 * (this.speed / 2);
  549.       this.f2 = "advancing";
  550.    }
  551.    function advancing()
  552.    {
  553.       this.c = this.c + 1;
  554.       if(this.c > this.advanceMax)
  555.       {
  556.          this.xMovT = 0;
  557.          this.c = 0;
  558.          this.f2 = "wait";
  559.          _root.d = _root.d + 1;
  560.          _root.attachMovie("sight","sightClip",_root.d);
  561.          _root.sightClip.gotoAndStop("hindSight");
  562.          _root.sightClip._x = this.x;
  563.          _root.sightClip._y = this.y;
  564.          if(_root.advanceDir == "L")
  565.          {
  566.             _root.sightClip._rotation = 180;
  567.          }
  568.          if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  569.          {
  570.             _root.broBehind();
  571.          }
  572.          removeMovieClip(_root.sightClip);
  573.       }
  574.    }
  575.    function wander()
  576.    {
  577.       if(random(100) > 98 + _root.dif.wander)
  578.       {
  579.          this[this.axis + "MovT"] = 0;
  580.          this.axis = this.axis != "x" ? "x" : "y";
  581.          this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  582.          this.getDirString();
  583.       }
  584.       if(random(100) > 97 + _root.dif.wander)
  585.       {
  586.          this.switchScope();
  587.       }
  588.    }
  589.    function death2()
  590.    {
  591.       _root.removeChar("bugA" + this.id);
  592.       this.f2 = "";
  593.    }
  594.    function main()
  595.    {
  596.       this[this.f2]();
  597.       if(this.oldDir != this.dir)
  598.       {
  599.          this.clip.gotoAndStop("fly" + this.dir);
  600.       }
  601.       this.oldDir = this.dir;
  602.       if(random(300) >= 299 + _root.dif.wander)
  603.       {
  604.          _root.d = _root.d + 1;
  605.          _root.attachMovie("feeler","feelerClip",_root.d);
  606.          if(this.dir == "L")
  607.          {
  608.             var _loc9_ = [-310,0,300,50];
  609.          }
  610.          else if(this.dir == "R")
  611.          {
  612.             _loc9_ = [50,0,300,50];
  613.          }
  614.          else if(this.dir == "U")
  615.          {
  616.             _loc9_ = [0,-310,50,300];
  617.          }
  618.          else
  619.          {
  620.             _loc9_ = [0,50,300,50];
  621.          }
  622.          _root.feelerClip._x = this.x + _loc9_[0];
  623.          _root.feelerClip._y = this.y + _loc9_[1];
  624.          _root.feelerClip._width = _loc9_[2];
  625.          _root.feelerClip._height = _loc9_[3];
  626.          var _loc4_ = 0;
  627.          var _loc8_ = _root.chars.length;
  628.          var _loc7_ = false;
  629.          while(_loc4_ < _loc8_)
  630.          {
  631.             var _loc6_ = _root.chars[_loc4_] + "Clip";
  632.             if(_root.feelerClip.hitTest(_root[_loc6_]))
  633.             {
  634.                var _loc3_ = _root.chars[_loc4_];
  635.                if(_root[_loc3_].Name.substr(0,3) != "bro")
  636.                {
  637.                   _loc7_ = true;
  638.                }
  639.             }
  640.             _loc4_ = _loc4_ + 1;
  641.          }
  642.          removeMovieClip(_root.feelerClip);
  643.          if(!_loc7_)
  644.          {
  645.             _root.d = _root.d + 1;
  646.             _root.attachMovie("sight","sightClip",_root.d);
  647.             _root.sightClip._x = this.x;
  648.             _root.sightClip._y = this.y;
  649.             if(this.dir == "U")
  650.             {
  651.                _root.sightClip._rotation = 90;
  652.             }
  653.             else if(this.dir == "R")
  654.             {
  655.                _root.sightClip._rotation = 180;
  656.             }
  657.             else if(this.dir == "D")
  658.             {
  659.                _root.sightClip._rotation = -90;
  660.             }
  661.             if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  662.             {
  663.                this.clip.body.charger.gotoAndPlay("fire");
  664.                this.clip.body.eye1.gotoAndPlay("fire");
  665.                this.clip.body.eye2.gotoAndPlay("fire");
  666.                this.clip.body.eye3.gotoAndPlay("fire");
  667.                this.firing = true;
  668.                this.fc = 0;
  669.             }
  670.             removeMovieClip(_root.sightClip);
  671.          }
  672.       }
  673.       if(this.firing)
  674.       {
  675.          this.fc = this.fc + 1;
  676.          if(this.fc == 5)
  677.          {
  678.             if(this.dir == "L")
  679.             {
  680.                var _loc11_ = this.x - 24;
  681.                var _loc13_ = this.y + 12;
  682.                var _loc14_ = this.x - 24;
  683.                var _loc12_ = this.y + 6;
  684.             }
  685.             else if(this.dir == "R")
  686.             {
  687.                _loc11_ = this.x + 9;
  688.                _loc13_ = this.y + 12;
  689.                _loc14_ = this.x + 9;
  690.                _loc12_ = this.y + 6;
  691.             }
  692.             else if(this.dir == "U")
  693.             {
  694.                _loc11_ = this.x + 12;
  695.                _loc13_ = this.y - 24;
  696.                _loc14_ = this.x + 6;
  697.                _loc12_ = this.y - 24;
  698.             }
  699.             else
  700.             {
  701.                _loc11_ = this.x + 12;
  702.                _loc13_ = this.y + 3;
  703.                _loc14_ = this.x + 6;
  704.                _loc12_ = this.y + 3;
  705.             }
  706.             _root.enemyShotID = _root.enemyShotID + 1;
  707.             _root["bugAFireA" + _root.enemyShotID] = new classes.shots.BugAFireA(_loc11_,_loc13_,this.dir,_root.enemyShotID);
  708.             _root.addEnemyShot("bugAFireA" + _root.enemyShotID);
  709.             _root.enemyShotID = _root.enemyShotID + 1;
  710.             _root["bugAFireB" + _root.enemyShotID] = new classes.shots.BugAFireB(_loc14_,_loc12_,this.dir,_root.enemyShotID);
  711.             _root.addEnemyShot("bugAFireB" + _root.enemyShotID);
  712.             _root.audio.playLevel3("bugAFire",_root.randRange(15,25));
  713.          }
  714.       }
  715.       if(this.nudging)
  716.       {
  717.          this.xA *= 0.5;
  718.          this.yA *= 0.5;
  719.          this.nc = this.nc + 1;
  720.          var _loc10_ = 255 - this.nc * 17;
  721.          this.colorTrans.redOffset = _loc10_;
  722.          this.colorTrans.greenOffset = _loc10_;
  723.          this.trans.colorTransform = this.colorTrans;
  724.          if(this.nc == 15)
  725.          {
  726.             this.xA = this.yA = 0;
  727.             this.nudging = false;
  728.             this.colorTrans.redOffset = this.colorR;
  729.             this.colorTrans.greenOffset = this.colorR;
  730.             this.trans.colorTransform = this.colorTrans;
  731.          }
  732.       }
  733.       _loc4_ = 0;
  734.       _loc8_ = _root.broShots.length;
  735.       while(_loc4_ < _loc8_)
  736.       {
  737.          _loc6_ = _root.broShots[_loc4_] + "Clip";
  738.          if(this.clip.hitTest(_root[_loc6_]))
  739.          {
  740.             _loc3_ = _root.broShots[_loc4_];
  741.             var _loc5_ = this.life;
  742.             this.life -= _root[_loc3_].power;
  743.             if(this.life < 1)
  744.             {
  745.                this.f2 = "death";
  746.             }
  747.             else
  748.             {
  749.                this.nudge(_root[_loc3_].xMov,_root[_loc3_].yMov,5);
  750.                _root.audio.playLevel4("bugHit" + (random(4) + 1),_root.randRange(7,15));
  751.             }
  752.             _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
  753.             _root[_loc3_].exploX = this.x + this.clip._width / 2;
  754.             _root[_loc3_].exploY = this.y + this.clip._height / 2;
  755.             _root[_loc3_].hit(_loc5_);
  756.             break;
  757.          }
  758.          _loc4_ = _loc4_ + 1;
  759.       }
  760.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  761.       {
  762.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  763.          this.f2 = "death";
  764.       }
  765.       if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
  766.       {
  767.          delete _root["form" + this.form[0]];
  768.          delete _root["formB" + this.form[0]];
  769.          this.f2 = "death2";
  770.       }
  771.       if(this.xMovT < this.xMov)
  772.       {
  773.          this.xMov -= 1;
  774.       }
  775.       else if(this.xMovT > this.xMov)
  776.       {
  777.          this.xMov += 1;
  778.       }
  779.       else
  780.       {
  781.          this.xMov = this.xMovT;
  782.       }
  783.       if(this.yMovT < this.yMov)
  784.       {
  785.          this.yMov -= 1;
  786.       }
  787.       else if(this.yMovT > this.yMov)
  788.       {
  789.          this.yMov += 1;
  790.       }
  791.       else
  792.       {
  793.          this.yMov = this.yMovT;
  794.       }
  795.       this.x += this.xMov + this.xA;
  796.       this.y += this.yMov + this.yA;
  797.       this.clip._x = this.x;
  798.       this.clip._y = this.y;
  799.    }
  800. }
  801.